cmake_minimum_required(VERSION 3.4.1)

project(addon)

add_library(addon SHARED addon.cpp)
target_include_directories(addon PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../app/src/main/cpp/include/node)
target_compile_definitions(addon PRIVATE
        "BUILDING_UV_SHARED=1"
        "BUILDING_V8_SHARED=1"
        "NODE_GYP_MODULE_NAME=addon"
        "USING_UV_SHARED=1"
        "USING_V8_SHARED=1"
        "V8_DEPRECATION_WARNINGS=1"
        "BUILDING_NODE_EXTENSION"
)
target_compile_options(addon PRIVATE "-fPIC")
# target_compile_options(addon PRIVATE "-fPIC" "-Wl,-rpath,'$ORTGIN'")
set_target_properties(addon PROPERTIES BUILD_RPATH "$ORIGIN")
set_target_properties(addon PROPERTIES PREFIX "")
set_target_properties(addon PROPERTIES SUFFIX ".node")
target_link_libraries(addon ${CMAKE_CURRENT_SOURCE_DIR}/../app/src/main/cpp/lib/libnode.so)